﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
namespace Lbb.Data
{
    /// <summary>
    /// 操作库接口。
    /// </summary>
    /// Author          Chiron
    /// CreateDate      2011-5-11
    /// LastEditDate    2011-5-11
    interface IRepositroy : IDisposable
    {
        DataContext DB { get; }
        void Save();
    }

    /// <summary>
    /// 操作库接口
    /// </summary>
    /// <typeparam name="T">
    /// 类
    /// </typeparam>
    /// Author          Chiron
    /// CreateDate      2011-5-19
    /// LastEditDate    2011-5-19
    interface IRepositroy<T> : IRepositroy
    {
        #region Get
        IQueryable<T> GetAll();
        IQueryable<T> GetAll(int startIndex, int size, out int total);
        #endregion

        #region Add
        void Add(T obj);
        void AddRange(IEnumerable<T> objs);
        #endregion

        #region Set
        void Update(T obj);
        void UpdateRange(IEnumerable<T> objs);
        #endregion

        #region Del
        void Delete(T obj);
        void DeleteRange(IEnumerable<T> objs);
        #endregion
    }
}
